#include <iostream>
#include <cmath>
using namespace std;
int countnum(int n)
{
	int count=0;
   while(n)
   {
      count+=n%10;
	  n/=10;
   }
   return count;
}
int main()
{
  int i,j=0;
  cin>>i;
  for(int k=1;k<=i;k++)
  {
    j+=countnum(k);
  }
      cout<<j<<endl;
  return 0;
}